package cn.micai.base.string;

/**
 * 描述：
 * <p>
    如果你叫str1.compareTo(str2)
    如果它返回
    正数：str1大于str2
    0:str1等于str2
    负数：str1比str2小
 *
 *
 * @author: 赵新国
 * @date: 2018/6/11 10:44
 */
public class StringCompareToExampleMain {

    public static void main(String [] args) {
        String str1 = "java2blog";
        String str2 = "hello";
        String str3 = "world";
        String str4 = "java2blog";
        String str5 = "JAVA2BLOG";
        System.out.println("comparing java2blog with hello: " + str1.compareTo(str2));
        System.out.println("comparing hello with world: " + str2.compareTo(str3));
        System.out.println("comparing java2blog with java2blog : " + str1.compareTo(str4));
        System.out.println("comparing java2blog with JAVA2BLOG : " + str1.compareTo(str5));
    }
}
